package com.sd365.gateway.authorization.api.controller;

import com.sd365.common.core.common.controller.AbstractController;
import com.sd365.common.core.context.BaseContextHolder;
import com.sd365.gateway.authorization.api.Authorization;
import com.sd365.gateway.authorization.service.AuthorizationService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author
 * @version 1.0.0
 * @class
 * @classdesc
 * @date
 * @see
 * @since
 */
//@RestController
@RestController
public class AuthorizationController extends AbstractController implements Authorization {
    @Autowired
    private AuthorizationService authorizationService;
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Override
    public Boolean roleAuthorization(String token, String url) throws InterruptedException {
        BaseContextHolder.set("nowrap", new Object());
        return authorizationService.roleAuthorization(token, url);
    }

    @Override
    public Boolean commonResource(String url) throws InterruptedException {
        BaseContextHolder.set("nowrap", new Object());
        return authorizationService.commonResource(url);
    }
}
